<template>
  <div>
    <el-table border
              v-loading="loading"
              size="small"
              :data="dataSource"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              :default-sort = "{prop: 'inDate', order: 'descending'}">
      <el-table-column prop="number"  fixed width="170" label="资产ID"></el-table-column>
      <el-table-column prop="name" fixed width="150" label="资产名称" sortable></el-table-column>
      <el-table-column prop="contractNamber"   width="150" label="合同号"></el-table-column>
      <el-table-column prop="batch" width="120" label="批次" sortable></el-table-column>
      <el-table-column prop="inDate" width="120" label="入库日期" sortable></el-table-column>
      <el-table-column prop="price" width="120" label="单价（元）" sortable></el-table-column>
      <el-table-column width="300" label="规格型号" sortable>
        <template slot-scope="scope">
          <el-tooltip :content="scope.row.model"  effect="light">
            <span> {{scope.row.model}}</span>
          </el-tooltip>
        </template>
      </el-table-column>
      <el-table-column width="150" prop="name" label="资产名称" sortable></el-table-column>
      <el-table-column width="110" prop="code" label="分类编码" sortable></el-table-column>
      <el-table-column width="120" label="资产大类" sortable>
        <template slot-scope="scope">
          {{ ['土地','房屋及构筑物','通用设备','车辆','专用设备','文物及陈列品','图书档案','家具用具及装具'][scope.row.classes-1] }}
        </template>
      </el-table-column>
      <el-table-column width="150" prop="typeName" label="分类名称" sortable></el-table-column>
<!--      <el-table-column width="150" prop="depreciationMonth" label="资产折旧总月数" sortable></el-table-column>-->
      <el-table-column prop="buyer" width="180" label="购买单位" sortable></el-table-column>
      <el-table-column label="使用状态">
        <template slot-scope="scope">
          {{ ['正常','损坏'][scope.row.useState-1] }}
        </template>
      </el-table-column>
      <el-table-column prop="usefulLife" width="120" label="使用期限" sortable></el-table-column>
      <el-table-column label="资产状态">
        <template slot-scope="scope">
          {{ ['闲置','已领用','已处置'][scope.row.state-1] }}
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="150">
        <template slot-scope="scope">
          <el-button @click="handleDetail(scope.row)" type="text">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination
      :total="ipagination.total"
      :page.sync="ipagination.current"
      :limit.sync="ipagination.pageSize"
      @pagination="loadData"
    ></pagination>
    <asset-modal ref="modalForm" @ok="modalFormOk"></asset-modal>
  </div>
</template>

<script>
  import { SingleTableMixins } from '@/mixins/SingleTableMixins'
  import Pagination from '@/components/Pagination'
  import AssetModal from '../modules/AssetModal'



  export default {
    mixins: [ SingleTableMixins ],
    components: {AssetModal, Pagination},
    name: 'returnItems',
    data(){
      return{
        url:{
          list:"/retrocede/listItemByMainId"
        },
        disableMixinCreated: true,
      }
    },
    methods: {
      getDataByMain(id,row) {
        this.searchModel.mainId = id;
        this.loadData(1);
      },
    }
  }
</script>

<style scoped>

</style>
